/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package action;

import dao.CategoryDAO;
import dao.mysql.CategoryDAOImpl;
import javax.servlet.http.HttpServletRequest;
import utility.DBConnection;

/**
 *
 * @author Student
 */
public class ProductNewAction implements Action {

    @Override
    public String execute(HttpServletRequest request) {
        String url = "";
        DBConnection db = new DBConnection();
        CategoryDAO dao = new CategoryDAOImpl(db.getConnection());
        try {
            request.setAttribute("categories", dao.getAllCategory());
            url = "product_new.jsp";
        } catch (Exception ex) {
            request.setAttribute("message", ex.getMessage());
            url = "errors.jsp";
        }
        return url;
    }
}
